<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>CleanPaste for YUI Rich Text Editor Example</title>
    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/menu/assets/skins/sam/menu.css" />
    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/fonts/fonts-min.css" />
    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/editor/assets/skins/sam/editor.css" />
    <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/menu/menu-min.js"></script>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/editor/editor-min.js"></script>
    <script type="text/javascript" src="CleanPaste.js"></script>
</head>
<body class=" yui-skin-sam">
    <form method="post" action="#" id="form1">
        <textarea id="editor" name="editor" rows="20" cols="75">
        This is some more test text.<br>This is some more test text.<br>This is some more test text.<br>
        This is some more test text.<br>This is some more test text.<br>This is some more test text.
        </textarea>
        <p>Paste event log:</p>
        <div id="Log" style="border: 1px solid black; width: 580px; height: 200px; overflow: auto; padding: 10px"></div>
    </form>
    <script type="text/javascript">
        (function() {
            //Setup some private variables
            var Dom = YAHOO.util.Dom,
                Event = YAHOO.util.Event;

            //The SimpleEditor config
            var myConfig = {
                height: '300px',
                width: '600px',
                dompath: true,
                focusAtStart: true,
                filterWord: true,
                removeLineBreaks: true
            };

            //Now let's load the SimpleEditor..
            var myEditor = new YAHOO.widget.Editor('editor', myConfig);
            myEditor.render();

            // Create a CleanPaste object to strip HTML formatting from pasted text
            var cleanPaste = new CleanPaste(myEditor);

            // Example of an OnBeforePaste event (this is not required to use CleanPaste)
            cleanPaste.OnBeforePaste = function(params) {
                var log = document.getElementById("Log");
                log.innerHTML += "OnBeforePaste event fired!<br />";

                // A parameter object is passed to the OnBeforePaste event with 2 properties:
                // sourceText: The original text pasted by the user
                // cleanText: The pasted text after it has been cleaned
                // You can change the value of the cleanText property before it is pasted
                // e.g. params.cleanText = "[" + params.cleanText + "]";
            }

            // Example of an OnAfterPaste event (this is not required to use CleanPaste)
            cleanPaste.OnAfterPaste = function(params) {
                var log = document.getElementById("Log");
                log.innerHTML += "OnAfterPaste event fired!<br />";

                // A parameter object is passed to the OnAfterPaste event with 2 properties:
                // sourceText: The original text pasted by the user
                // cleanText: The pasted text after it has been cleaned
            }
        })();
    </script>
</body>
</html>